package com.easy.cms.material.dao;

import com.easy.cms.material.model.Material;
import jakarta.annotation.Nonnull;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.domain.Specification;
import org.springframework.data.repository.CrudRepository;

import java.util.Optional;

public interface MaterialRepository extends CrudRepository<Material, Long> {
    Material save(@Nonnull Material material);
    void deleteById(@Nonnull Long id);
    Iterable<Material> findAll();
    Optional<Material> findById(@Nonnull Long id);
    java.util.List<Material> findByStandardCodeContainingOrNameContaining(String code, String name);
    Page<Material> findAll(org.springframework.data.domain.Pageable pageable);

    Page<Material> findAll(Specification<Material> spec, Pageable pageable);
}